package com.xxonehjh.demo.spring.core;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.xxonehjh.demo.spring.core.services.CommandManager;
import com.xxonehjh.demo.spring.core.services.PetStore;

/**
 * 
 * @author huangjh
 * @date 2021-6-28 15:15:43
 */
public class App {

	public static void main(String[] args) {
		// DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
		// AutowiredAnnotationBeanPostProcessor
		// DefaultAdvisorAutoProxyCreator
		// TargetSource
		// PoolingConfig
		// ThreadLocalTargetSource
		// Advice 
		try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("services.xml")) {
			PetStore store = context.getBean(PetStore.class);
			System.out.println("price for 【abc】=> " + store.getPrice("abc"));
			System.out.println(context.getType("petStore"));
			System.out.println(context.getType("petStoreName"));

			CommandManager commandManager = context.getBean(CommandManager.class);
			System.out.println(commandManager.process("abc"));
			System.out.println(context.getType("commandManager"));
			// context.getBeanFactory().registerScope(scopeName, scope); 自定义作用域

			context.registerShutdownHook();
		}
	}

}